package top.frsf.starter.config;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration;
import top.frsf.starter.feign.IDeviceClient;
import top.frsf.starter.properties.FriotClientProperties;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * @author He Kuntao
 * @desc Friot Cloud Auto Config
 * @date 2024/3/15 21:32
 */
@Configuration
@EnableConfigurationProperties(FriotClientProperties.class)
@EnableFeignClients(clients = {IDeviceClient.class})
public class FriotCloudAutoConfig {

    @Resource
    private FriotClientProperties friotClientProperties;

    @PostConstruct
    public void init() {
        if (friotClientProperties.getToken() == null) {
            throw new RuntimeException("Friot Cloud token is null");
        }
    }
}
